import type { PageList, ResponseStruct } from '#/global'

export interface DepartmentsVo {
  id?: number;
  name?: string,
  school_id?: number
}

export interface DepartmentsSearchVo {
  name?: string,
  school_id?: number
}

export function page(data: DepartmentsSearchVo): Promise<ResponseStruct<PageList<DepartmentsVo>>> {
  return useHttp().get('/admin/departments', { params: data })
}

export function create(data: DepartmentsVo): Promise<ResponseStruct<null>> {
  return useHttp().post('/admin/departments', data)
}

export function save(id: number, data: DepartmentsVo): Promise<ResponseStruct<null>> {
  return useHttp().put(`/admin/departments/${id}`, data)
}

export function deleteByIds(ids: number[]): Promise<ResponseStruct<null>> {
  return useHttp().delete('/admin/departments', { data: ids })
}

